function d = calcDist2(H,pts1,pts2)
pts11(1,:)=pts1(1,:);
pts11(2,:)=pts1(2,:);
pts22(1,:)=pts2(1,:);
pts22(2,:)=pts2(2,:);
X11=[pts22;ones(1,size(pts1,2))];
HX2=H*X11;
X2x=HX2(1,:)./HX2(3,:);
X2y=HX2(2,:)./HX2(3,:);
X2=[X2x;X2y];
d = sqrt(sum((pts11-X2).^2,1));

end